package com.gitee.magic.converter;

import com.gitee.magic.core.converter.AbstractConverterEditor;
import com.gitee.magic.core.json.JsonArray;

/**
 * @author start
 */
public class JsonArrayConverterEditor extends AbstractConverterEditor<String>  {
	
	public JsonArrayConverterEditor(Class<?> prototype) {
		super(prototype);
	}

	@Override
	public void restore(Object value) {
		if(value!=null) {
			setValue(new JsonArray(String.valueOf(value)));
		}
	}

	@Override
	public String converter() {
		if(getValue()==null) {
			return null;
		}
		return ((JsonArray)getValue()).toString();
	}
	
}
